<?php

include 'lib/ActionsConnection.php';
include 'lib/ExamsRetriever.php';

// If the key is send via POST, use POST instead of GET.
if(isset($_POST['k'])){
    $_GET = $_POST;
}

$user = $_GET['u'];
$pass = $_GET['p'];
$key = $_GET['k'];

$actions = new ActionsConnection($user, $pass, $key);

$exams = new ExamsRetriever($actions);

$exams->retrieve();

$xml = $exams->toXml();

header ("Content-Type:text/xml");

echo $xml;


$actions->destroy();

?>